<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      @media print {
        .page {
          page-break-after: always;
        }
      }
    </style>
  </head>
  <body>
    <div id="box">11</div>
    <script>
      // "test": "playwright test  --project chromium --headed"
      //
      box.addEventListener("click", function () {
        // 添加多页内容
        document.body.innerHTML = `
      <div class="page">
        <h1>第二页内容</h1>
      </div>
      <div>
        <h1>第三页内容</h1>
      </div>
    `;

        // 打印
        setTimeout(() => window.print(), 100);
      });
    </script>
  </body>
</html>
